home *** CD-ROM | disk | FTP | other *** search
/ QRZ! Ham Radio 8 / QRZ Ham Radio Callsign Database - Volume 8.iso / mac / files / t_sys5 / 92052tar.gz / 920528.tar / rip.h < prev    next >
C/C++ Source or Header  |  1992-01-22  |  4KB  |  123 lines

  1. /* @(#) $Header: rip.h,v 1.3 92/01/22 11:12:39 deyke Exp $ */
  2.  
  3. #ifndef _RIP_H
  4. #define _RIP_H
  5.  
  6. /* Routing Information Protocol (RIP)
  7.  *
  8.  *      This code is derived from the 4.2 BSD version which was
  9.  * used as a spec since no formal specification is known to exist.
  10.  * See RFC 1009, Gateway Requirements, for more details. AGB 4-29-88
  11.  *
  12.  * The draft RIP RFC was used to develop most of this code. The above
  13.  * referred to the basics of the rip_recv() function of RIP.C. The RIP
  14.  * RFC has now been issued as RFC1058. AGB 7-23-88
  15.  *
  16.  * Substantially rewritten and integrated into NOS 9/1989 by KA9Q
  17.  */
  18. #ifndef _MBUF_H
  19. #include "mbuf.h"
  20. #endif
  21.  
  22. #ifndef _IFACE_H
  23. #include "iface.h"
  24. #endif
  25.  
  26. #ifndef _UDP_H
  27. #include "udp.h"
  28. #endif
  29.  
  30. #define RIP_INFINITY    16
  31. #define RIP_TTL         240     /* Default time-to-live for an entry */
  32. #define RIPVERSION      1
  33. #define RIP_IPFAM       2
  34.  
  35. /* UDP Port for RIP */
  36. #define RIP_PORT        520
  37.  
  38. /* RIP Packet Types */
  39. #define RIPCMD_REQUEST          1       /* want info */
  40. #define RIPCMD_RESPONSE         2       /* responding to request */
  41. #define RIPCMD_MAX              3
  42.  
  43. #define HOPCNT_INFINITY         16      /* per Xerox NS */
  44. #define MAXRIPROUTES            25      /* maximum # routes per RIP pkt */
  45.  
  46. struct rip_list {
  47.     struct rip_list *prev;
  48.     struct rip_list *next;  /* doubly linked list */
  49.  
  50.     /* address to scream at periodically:
  51.      * this address must have a direct network interface route and an
  52.      * ARP entry for the appropriate  hardware broadcast address, if approp.
  53.      */
  54.     int32 dest;
  55.  
  56.     /* basic rate of RIP clocks on this net interface */
  57.     int32 interval;
  58.  
  59.     struct timer rip_time;  /* time to output next on this net. iface */
  60.  
  61.     /* the interface to transmit on  and receive from */
  62.     struct iface *iface;
  63.  
  64.     /* described below with the mask defs */
  65.     char    flags;
  66. #define RIP_SPLIT 0x1   /* Do split horizon processing */
  67. #define RIP_US  0x2     /* Include ourselves in the list */
  68. };
  69. #define NULLRL  (struct rip_list *)0
  70.  
  71. /* Host format of a single entry in a RIP response packet */
  72. struct rip_route {
  73.     int16   addr_fam;
  74.     int32   target;
  75.     int32   metric;
  76. };
  77. #define RIPROUTE        20      /* Size of each routing entry */
  78. #define RIPHEADER       4       /* Size of rip header before routes */
  79. #define MAXRIPPACKET    RIPHEADER + (MAXRIPROUTES*RIPROUTE)
  80.  
  81. /* RIP statistics counters */
  82. struct rip_stat {
  83.     int32 output;           /* Packets sent */
  84.     int32 rcvd;             /* Packets received */
  85.     int32 request;          /* Number of request packets received */
  86.     int32 response;         /* Number of responses received */
  87.     int32 unknown;          /* Number of unknown command pkts received */
  88.     int32 version;          /* Number of version errors */
  89.     int32 addr_family;      /* Number of address family errors */
  90.     int32 refusals;         /* Number of packets dropped from a host
  91.                     on the refuse list */
  92. };
  93.  
  94. struct rip_refuse {
  95.     struct rip_refuse *prev;
  96.     struct rip_refuse *next;
  97.     int32   target;
  98. };
  99. #define NULLREF (struct rip_refuse *)0
  100.  
  101. /* RIP primitives */
  102. int rip_init __ARGS((void));
  103. void rt_timeout __ARGS((void *s));
  104. void rip_trigger __ARGS((void));
  105. int rip_add __ARGS((int32 dest,int32 interval,int flags));
  106. int riprefadd __ARGS((int32 gateway));
  107. int riprefdrop __ARGS((int32 gateway));
  108. int ripreq __ARGS((int32 dest,int replyport));
  109. int rip_drop __ARGS((int32 dest));
  110. int nbits __ARGS((int32 target));
  111. void pullentry __ARGS((struct rip_route *ep,struct mbuf **bpp));
  112.  
  113. /* RIP Definition */
  114. extern int16 Rip_trace;
  115. extern int Rip_merge;
  116. extern struct rip_stat Rip_stat;
  117. extern struct rip_list *Rip_list;
  118. extern struct rip_refuse *Rip_refuse;
  119. extern struct udp_cb *Rip_cb;
  120.  
  121. #endif  /* _RIP_H */
  122.  
  123.